package br.com.northwind.janelas;

import java.awt.Dimension;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.BorderFactory;
import javax.swing.border.EtchedBorder;

public class Frm_Products extends JFrame implements ActionListener {

	private static final long serialVersionUID = 1L;

	private JPanel jContentPane = null;

	private JPanel jpnl_Crud = null;

	private JButton jbtn_Create = null;

	private JButton jbtn_Read = null;

	private JButton jbtn_Update = null;

	private JButton jbtn_Delete = null;

	private JPanel jpnl_Navigation = null;

	private JButton jbtn_First = null;

	private JButton jbtn_Previous = null;

	private JTextField jtxfld_Current = null;

	private JButton jbtn_Next = null;

	private JButton jbtn_Last = null;

	private JLabel jlb_ProductId = null;

	private JTextField jtxfld_ProductId = null;

	private JLabel jlb_ProductName = null;

	private JTextField jtxfld_ProductName = null;

	private JLabel jlb_CategoryId = null;

	private JTextField jtxfld_QuantityPerUnit = null;

	private JLabel jlb_SupplierId = null;

	private JLabel jlb_QuantityPerUnit = null;

	private JComboBox jcmbx_SupplierId = null;

	private JComboBox jcmbx_CategoryId = null;

	private JLabel jlb_UnitPrice = null;

	private JLabel jlb_UnitsInStock = null;

	private JLabel jlb_UnitsOnOrder = null;

	private JTextField jtxfld_UnitPrice = null;

	private JTextField jtxfld_UnitsInStock = null;

	private JTextField jtxfld_UnitPrice1 = null;

	private JLabel jlb_ReorderLevel = null;

	private JTextField jtxfld_ReorderLevel = null;

	private JLabel jlb_Discontinued = null;

	private JCheckBox jchkbx_Discontinued = null;

	private JButton jbtn_Cancel = null;

	private JButton jbtn_Exit = null;

	private JButton jbtn_Save = null;

	private JPanel jpnl_ControlButtons = null;

	/**
	 * @param owner
	 */
	public Frm_Products() {
		super();
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setTitle("Products");
		this.setSize(380, 440);
		this.setContentPane(getJContentPane());
		this.setResizable(false);
		this.setLocationRelativeTo(null);
		this.setAlwaysOnTop(true);
		this.setVisible(true);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			jlb_Discontinued = new JLabel();
			jlb_Discontinued.setText("Discontinued.:");
			jlb_Discontinued.setSize(new Dimension(90, 21));
			jlb_Discontinued.setLocation(new Point(10, 227));
			jlb_ReorderLevel = new JLabel();
			jlb_ReorderLevel.setText("Reorder Levelr.:");
			jlb_ReorderLevel.setSize(new Dimension(95, 21));
			jlb_ReorderLevel.setLocation(new Point(190, 196));
			jlb_UnitsOnOrder = new JLabel();
			jlb_UnitsOnOrder.setText("Units On Order.:");
			jlb_UnitsOnOrder.setLocation(new Point(10, 196));
			jlb_UnitsOnOrder.setSize(new Dimension(100, 21));
			jlb_UnitsInStock = new JLabel();
			jlb_UnitsInStock.setText("Units In Stock.:");
			jlb_UnitsInStock.setLocation(new Point(170, 165));
			jlb_UnitsInStock.setSize(new Dimension(90, 21));
			jlb_UnitPrice = new JLabel();
			jlb_UnitPrice.setText("Unit Price.:");
			jlb_UnitPrice.setLocation(new Point(10, 165));
			jlb_UnitPrice.setSize(new Dimension(70, 21));
			jlb_QuantityPerUnit = new JLabel();
			jlb_QuantityPerUnit.setText("Quantity Per Unit.:");
			jlb_QuantityPerUnit.setLocation(new Point(10, 134));
			jlb_QuantityPerUnit.setSize(new Dimension(110, 21));
			jlb_SupplierId = new JLabel();
			jlb_SupplierId.setText("Supplier.:");
			jlb_SupplierId.setSize(new Dimension(85, 21));
			jlb_SupplierId.setLocation(new Point(10, 72));
			jlb_CategoryId = new JLabel();
			jlb_CategoryId.setText("Category.:");
			jlb_CategoryId.setLocation(new Point(10, 103));
			jlb_CategoryId.setSize(new Dimension(85, 21));
			jlb_ProductName = new JLabel();
			jlb_ProductName.setText("Product Name.:");
			jlb_ProductName.setSize(new Dimension(95, 21));
			jlb_ProductName.setLocation(new Point(10, 41));
			jlb_ProductId = new JLabel();
			jlb_ProductId.setText("Product Id.:");
			jlb_ProductId.setSize(new Dimension(75, 21));
			jlb_ProductId.setLocation(new Point(10, 10));
			jContentPane = new JPanel();
			jContentPane.setLayout(null);
			jContentPane.add(getJpnl_Crud(), null);
			jContentPane.add(getJpnl_Navigation(), null);
			jContentPane.add(getJpnl_ControlButtons(), null);
			jContentPane.add(jlb_ProductId, null);
			jContentPane.add(jlb_ProductName, null);
			jContentPane.add(jlb_SupplierId, null);
			jContentPane.add(jlb_CategoryId, null);
			jContentPane.add(jlb_QuantityPerUnit, null);
			jContentPane.add(jlb_UnitPrice, null);
			jContentPane.add(jlb_UnitsInStock, null);
			jContentPane.add(jlb_UnitsOnOrder, null);
			jContentPane.add(jlb_ReorderLevel, null);
			jContentPane.add(jlb_Discontinued, null);
			jContentPane.add(getJchkbx_Discontinued(), null);
			jContentPane.add(getJcmbx_SupplierId(), null);
			jContentPane.add(getJcmbx_CategoryId(), null);
			jContentPane.add(getJtxfld_ProductId(), null);
			jContentPane.add(getJtxfld_ProductName(), null);
			jContentPane.add(getJtxfld_QuantityPerUnit(), null);
			jContentPane.add(getJtxfld_UnitPrice(), null);
			jContentPane.add(getJtxfld_UnitsInStock(), null);
			jContentPane.add(getJtxfld_UnitPrice1(), null);
			jContentPane.add(getJtxfld_ReorderLevel(), null);
		}
		return jContentPane;
	}

	/**
	 * This method initializes jpnl_Crud	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJpnl_Crud() {
		if (jpnl_Crud == null) {
			jpnl_Crud = new JPanel();
			jpnl_Crud.setLayout(null);
			jpnl_Crud.setLocation(new Point(10, 260));
			jpnl_Crud.setSize(new Dimension(350, 41));
			jpnl_Crud.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
			jpnl_Crud.add(getJbtn_Create(), null);
			jpnl_Crud.add(getJbtn_Read(), null);
			jpnl_Crud.add(getJbtn_Update(), null);
			jpnl_Crud.add(getJbtn_Delete(), null);
		}
		return jpnl_Crud;
	}

	/**
	 * This method initializes jbtn_Create	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJbtn_Create() {
		if (jbtn_Create == null) {
			jbtn_Create = new JButton();
			jbtn_Create.setText("Create");
			jbtn_Create.setSize(new Dimension(75, 21));
			jbtn_Create.setLocation(new Point(10, 10));
		}
		return jbtn_Create;
	}

	/**
	 * This method initializes jbtn_Read	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJbtn_Read() {
		if (jbtn_Read == null) {
			jbtn_Read = new JButton();
			jbtn_Read.setText("Read");
			jbtn_Read.setSize(new Dimension(75, 21));
			jbtn_Read.setLocation(new Point(95, 10));
		}
		return jbtn_Read;
	}

	/**
	 * This method initializes jbtn_Update	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJbtn_Update() {
		if (jbtn_Update == null) {
			jbtn_Update = new JButton();
			jbtn_Update.setText("Update");
			jbtn_Update.setSize(new Dimension(75, 21));
			jbtn_Update.setLocation(new Point(180, 10));
		}
		return jbtn_Update;
	}

	/**
	 * This method initializes jbtn_Delete	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJbtn_Delete() {
		if (jbtn_Delete == null) {
			jbtn_Delete = new JButton();
			jbtn_Delete.setText("Delete");
			jbtn_Delete.setSize(new Dimension(75, 21));
			jbtn_Delete.setLocation(new Point(265, 10));
		}
		return jbtn_Delete;
	}

	/**
	 * This method initializes jpnl_Navigation	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJpnl_Navigation() {
		if (jpnl_Navigation == null) {
			jpnl_Navigation = new JPanel();
			jpnl_Navigation.setLayout(null);
			jpnl_Navigation.setLocation(new Point(10, 310));
			jpnl_Navigation.setSize(new Dimension(350, 41));
			jpnl_Navigation.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
			jpnl_Navigation.add(getJbtn_First(), null);
			jpnl_Navigation.add(getJbtn_Previous(), null);
			jpnl_Navigation.add(getJtxfld_Current(), null);
			jpnl_Navigation.add(getJbtn_Next(), null);
			jpnl_Navigation.add(getJbtn_Last(), null);
		}
		return jpnl_Navigation;
	}

	/**
	 * This method initializes jbtn_First	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJbtn_First() {
		if (jbtn_First == null) {
			jbtn_First = new JButton();
			jbtn_First.setIcon(new ImageIcon(getClass().getResource("/images/firstRecord.png")));
			jbtn_First.setSize(new Dimension(21, 21));
			jbtn_First.setHorizontalTextPosition(SwingConstants.CENTER);
			jbtn_First.setPreferredSize(new Dimension(50, 50));
			jbtn_First.setLocation(new Point(30, 10));
		}
		return jbtn_First;
	}

	/**
	 * This method initializes jbtn_Previous	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJbtn_Previous() {
		if (jbtn_Previous == null) {
			jbtn_Previous = new JButton();
			jbtn_Previous.setLocation(new Point(61, 10));
			jbtn_Previous.setIcon(new ImageIcon(getClass().getResource("/images/previousRecord.png")));
			jbtn_Previous.setSize(new Dimension(21, 21));
		}
		return jbtn_Previous;
	}

	/**
	 * This method initializes jtxfld_Current	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJtxfld_Current() {
		if (jtxfld_Current == null) {
			jtxfld_Current = new JTextField();
			jtxfld_Current.setHorizontalAlignment(JTextField.CENTER);
			jtxfld_Current.setLocation(new Point(92, 10));
			jtxfld_Current.setText("");
			jtxfld_Current.setEditable(false);
			jtxfld_Current.setSize(new Dimension(160, 21));
		}
		return jtxfld_Current;
	}

	/**
	 * This method initializes jbtn_Next	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJbtn_Next() {
		if (jbtn_Next == null) {
			jbtn_Next = new JButton();
			jbtn_Next.setLocation(new Point(262, 10));
			jbtn_Next.setIcon(new ImageIcon(getClass().getResource("/images/nextRecord.png")));
			jbtn_Next.setSize(new Dimension(21, 21));
		}
		return jbtn_Next;
	}

	/**
	 * This method initializes jbtn_Last	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJbtn_Last() {
		if (jbtn_Last == null) {
			jbtn_Last = new JButton();
			jbtn_Last.setLocation(new Point(291, 10));
			jbtn_Last.setIcon(new ImageIcon(getClass().getResource("/images/lastRecord.PNG")));
			jbtn_Last.setSize(new Dimension(21, 21));
		}
		return jbtn_Last;
	}

	/**
	 * This method initializes jtxfld_ProductId	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJtxfld_ProductId() {
		if (jtxfld_ProductId == null) {
			jtxfld_ProductId = new JTextField();
			jtxfld_ProductId.setLocation(new Point(90, 10));
			jtxfld_ProductId.setEditable(false);
			jtxfld_ProductId.setText("");
			jtxfld_ProductId.setHorizontalAlignment(JTextField.CENTER);
			jtxfld_ProductId.setSize(new Dimension(75, 21));
		}
		return jtxfld_ProductId;
	}

	/**
	 * This method initializes jtxfld_ProductName	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJtxfld_ProductName() {
		if (jtxfld_ProductName == null) {
			jtxfld_ProductName = new JTextField();
			jtxfld_ProductName.setLocation(new Point(110, 41));
			jtxfld_ProductName.setSize(new Dimension(255, 21));
		}
		return jtxfld_ProductName;
	}

	/**
	 * This method initializes jtxfld_QuantityPerUnit	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJtxfld_QuantityPerUnit() {
		if (jtxfld_QuantityPerUnit == null) {
			jtxfld_QuantityPerUnit = new JTextField();
			jtxfld_QuantityPerUnit.setLocation(new Point(125, 134));
			jtxfld_QuantityPerUnit.setSize(new Dimension(237, 21));
		}
		return jtxfld_QuantityPerUnit;
	}

	/**
	 * This method initializes jcmbx_SupplierId	
	 * 	
	 * @return javax.swing.JComboBox	
	 */
	private JComboBox getJcmbx_SupplierId() {
		if (jcmbx_SupplierId == null) {
			jcmbx_SupplierId = new JComboBox();
			jcmbx_SupplierId.setLocation(new Point(100, 72));
			jcmbx_SupplierId.setSize(new Dimension(262, 21));
		}
		return jcmbx_SupplierId;
	}

	/**
	 * This method initializes jcmbx_CategoryId	
	 * 	
	 * @return javax.swing.JComboBox	
	 */
	private JComboBox getJcmbx_CategoryId() {
		if (jcmbx_CategoryId == null) {
			jcmbx_CategoryId = new JComboBox();
			jcmbx_CategoryId.setBounds(new Rectangle(100, 103, 262, 21));
		}
		return jcmbx_CategoryId;
	}

	/**
	 * This method initializes jtxfld_UnitPrice	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJtxfld_UnitPrice() {
		if (jtxfld_UnitPrice == null) {
			jtxfld_UnitPrice = new JTextField();
			jtxfld_UnitPrice.setLocation(new Point(85, 165));
			jtxfld_UnitPrice.setSize(new Dimension(80, 21));
		}
		return jtxfld_UnitPrice;
	}

	/**
	 * This method initializes jtxfld_UnitsInStock	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJtxfld_UnitsInStock() {
		if (jtxfld_UnitsInStock == null) {
			jtxfld_UnitsInStock = new JTextField();
			jtxfld_UnitsInStock.setSize(new Dimension(94, 21));
			jtxfld_UnitsInStock.setLocation(new Point(268, 165));
		}
		return jtxfld_UnitsInStock;
	}

	/**
	 * This method initializes jtxfld_UnitPrice1	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJtxfld_UnitPrice1() {
		if (jtxfld_UnitPrice1 == null) {
			jtxfld_UnitPrice1 = new JTextField();
			jtxfld_UnitPrice1.setLocation(new Point(115, 196));
			jtxfld_UnitPrice1.setSize(new Dimension(70, 21));
		}
		return jtxfld_UnitPrice1;
	}

	/**
	 * This method initializes jtxfld_ReorderLevel	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJtxfld_ReorderLevel() {
		if (jtxfld_ReorderLevel == null) {
			jtxfld_ReorderLevel = new JTextField();
			jtxfld_ReorderLevel.setLocation(new Point(290, 196));
			jtxfld_ReorderLevel.setSize(new Dimension(72, 21));
		}
		return jtxfld_ReorderLevel;
	}

	/**
	 * This method initializes jchkbx_Discontinued	
	 * 	
	 * @return javax.swing.JCheckBox	
	 */
	private JCheckBox getJchkbx_Discontinued() {
		if (jchkbx_Discontinued == null) {
			jchkbx_Discontinued = new JCheckBox();
			jchkbx_Discontinued.setSize(new Dimension(21, 21));
			jchkbx_Discontinued.setLocation(new Point(109, 227));
		}
		return jchkbx_Discontinued;
	}

	/**
	 * This method initializes jbtn_Cancel	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJbtn_Cancel() {
		if (jbtn_Cancel == null) {
			jbtn_Cancel = new JButton();
			jbtn_Cancel.setText("Cancel");
			jbtn_Cancel.setLocation(new Point(10, 10));
			jbtn_Cancel.setSize(new Dimension(75, 21));
		}
		return jbtn_Cancel;
	}

	/**
	 * This method initializes jbtn_Exit	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJbtn_Exit() {
		if (jbtn_Exit == null) {
			jbtn_Exit = new JButton();
			jbtn_Exit.setText("Exit");
			jbtn_Exit.setLocation(new Point(265, 10));
			jbtn_Exit.setSize(new Dimension(75, 21));
			jbtn_Exit.addActionListener(this);
		}
		return jbtn_Exit;
	}

	/**
	 * This method initializes jbtn_Save	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJbtn_Save() {
		if (jbtn_Save == null) {
			jbtn_Save = new JButton();
			jbtn_Save.setText("Save");
			jbtn_Save.setLocation(new Point(140, 10));
			jbtn_Save.setSize(new Dimension(75, 21));
		}
		return jbtn_Save;
	}

	/**
	 * This method initializes jpnl_ControlButtons	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJpnl_ControlButtons() {
		if (jpnl_ControlButtons == null) {
			jpnl_ControlButtons = new JPanel();
			jpnl_ControlButtons.setLayout(null);
			jpnl_ControlButtons.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
			jpnl_ControlButtons.setSize(new Dimension(350, 41));
			jpnl_ControlButtons.setLocation(new Point(10, 361));
			jpnl_ControlButtons.add(getJbtn_Cancel(), null);
			jpnl_ControlButtons.add(getJbtn_Save(), null);
			jpnl_ControlButtons.add(getJbtn_Exit(), null);
		}
		return jpnl_ControlButtons;
	}

	public void actionPerformed(ActionEvent e) {
		if (e.getSource() == jbtn_Exit ) {
			this.dispose();
		}		
	}

}  //  @jve:decl-index=0:visual-constraint="10,10"
